"""
进程基础示例 带有参数的过程函数
"""
from multiprocessing import Process
from time import sleep

def worker(name,sec):
    for i in range(3):
        sleep(sec)
        print("I'm %s"%name)
        print("I'm working...")

if __name__ == '__main__':
    # p = Process(target=worker,args=("Tom",2))
    # daemon设置为True,子进程随着父进程的结束而结束
    p = Process(target=worker,kwargs={"sec":2,"name":"Tom"},daemon=True)
    p.start()